struct fragment
{
	float4 position  : POSITION;
	float4 color0    : COLOR0;
	float2 texcoord0 : TEXCOORD0;
};

struct pixel
{
	float4 color : COLOR;
};

pixel main( fragment IN,
		    const uniform sampler2D texture,
		    const uniform sampler2D texture2,
			const uniform float1 time)
{
	pixel OUT;

	float localtime = time;

	float multiply = 2.0+sin(time*20)*0.5;
	float2 newtexcoord = IN.texcoord0*multiply;

	float4 texelcolor = tex2D(texture, newtexcoord);
	float4 texelcolor2 = tex2D(texture2, newtexcoord*1.5);
	texelcolor = sqrt(texelcolor);
	texelcolor2 *= 1.3;
	texelcolor2 *= texelcolor2;
	texelcolor *= 0.5;

	float t = 0.6+0.5*sin(IN.color0.b*25+time*28);
	float localalpha = 0.2 + 0.6*t;
	float4 pixelcol = texelcolor*t + texelcolor2*(1-t);

	OUT.color = pixelcol*localtime*localalpha;// * IN.color0;
	return OUT;

	
	
	
}
